//
// Created by wze-zero on 2024/10/18.
//
#include <iostream>

using namespace std;

int main() {
    int n, num, k, l;
    cin >> n >> num;
    char c[n], c1, c2;
    cin >> c;
    for (int i = 0; i < num; ++i) {
        cin >> k >> l >> c1 >> c2;
        for (int j = k-1; j <= l-1; ++j) {
            if (c[j] == c1) {
                c[j] = c2;
            }
        }
    }
    cout<<c<<endl;
    return 0;
}